%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Pick n correspondence points in the image pairs  %
%The function will return then the coords x and x'%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

function [x,xp] = select_corr(n,left_image,right_image)
%% Display the images
figure, imagesc(left_image); colormap(gray);axis image; 
figure, imagesc(right_image); colormap(gray);axis image;

%% Request correspondent points and save them
x = zeros(n,2);
xp = zeros(n,2);
for i=1:n
    figure(1);
    str1 = sprintf('Select the point number %d of the left image',i);
    title(str1);
    [left_x left_y] = ginput(1);
    hold on; plot(left_x, left_y,'r*');
    
	figure(2);
    str2 = sprintf('Select the point number %d of the right image',i);
    title(str2);
    [right_x right_y] = ginput(1);
    hold on; plot(right_x, right_y,'b*');
    	
    x(i,:) = [left_x left_y];
    xp(i,:) = [right_x right_y]; 
  
end
close all






